import './local_app.model.dart';
import './shared/services/shared_util.service.dart';

class LocalSetting {
  LocalSetting({
    required this.appList,
  });

  factory LocalSetting.fromJson(Map<String, dynamic> json) {
    return LocalSetting(
      appList: SharedUtil.tryToConvert<List<LocalApp>>(json['appList'],
          (p) => (p as List).map((p) => LocalApp.fromJson(p)).toList(),
          defaultValue: <LocalApp>[]),
    );
  }

  final List<LocalApp>? appList;

  Map<String, dynamic> toJson() {
    return {
      'appList': appList?.map((p) => p.toJson()).toList(),
    };
  }
}
